package dados;

import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;

public class Estatistica {
	
	public void plotarGrafico(DefaultCategoryDataset dataset,JLabel label,String title){		
        
        //JFreeChart chart1 = ChartFactory.createPieChart(title, dataset, false, false, false);
        
		// create the chart...
        final JFreeChart chart = ChartFactory.createBarChart(
            title,         
            "Anos",               
            "Número de Faltas",                  
            dataset,                  
            PlotOrientation.VERTICAL, 
            true,                     
            true,                     
            false                     
        );
		
    	BufferedImage image = chart.createBufferedImage(300,300);
    	label.setIcon(new ImageIcon(image));    	
	}

}
